﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace sunsetmp
{
    /// <summary>
    /// Interaction logic for LoginQuestionWindow.xaml
    /// </summary>
    public partial class LoginQuestionWindow : Window
    {

        Properties.Settings ps = Properties.Settings.Default;
        Core core;

        public LoginQuestionWindow(Core c)
        {
            InitializeComponent();
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            core = c;
            if (ps.autoLogin) 
                Autorizire();
            else 
                this.Show();
        }

        private void button1_Click_1(object sender, RoutedEventArgs e)
        {
            Autorizire();
        }

        private void Autorizire()
        {
            LoginWindow lw = new LoginWindow(core);
            lw.Autoriz();
            this.Close();
        }

        private void Close_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Minimize_Click(object sender, RoutedEventArgs e)
        {
            WindowState = System.Windows.WindowState.Minimized;
        }

        private void Grid_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        private void OfflineButton_Click(object sender, RoutedEventArgs e)
        {
            core.EnableVkButton();
            this.Close();
        }

        private void CheckScreen_Checked(object sender, RoutedEventArgs e)
        {
            ps.autoLogin = true;
            ps.Save();
        }

        private void Window_StateChanged_1(object sender, System.EventArgs e)
        {
            if (this.WindowState == System.Windows.WindowState.Maximized)
                this.WindowState = System.Windows.WindowState.Normal;
        }
    }
}
